feat(core): tip about VRA when a build uses Layout review mode (PER-9502)#2276
Open
prklm10 wants to merge 2 commits into
Open
feat(core): tip about VRA when a build uses Layout review mode (PER-9502)#2276prklm10 wants to merge 2 commits into
prklm10 wants to merge 2 commits into
Conversation
Emit a single warn-level tip just before the "Finalized build" log whenever any snapshot in the build had enableLayout set (via global config or per-snapshot). Detection flips a per-build flag in the queue push handler; emission is gated in the end handler, so it logs at most once per process. Parallel builds surface the tip per shard via core — cli-build finalize needs no change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
pranavz28
approved these changes
Jun 11, 2026
Emit a percy_cli_vra_recommendation_emitted build event (category percy:cli) when the VRA tip is shown, so the recommendation can be instrumented. Extends the client's sendBuildEvents to optionally send the newer top-level event_name and category params; existing callers are unaffected (params default and the API applies its own defaults). The event is sent before finalizing the build and is wrapped so telemetry can never fail a build. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
warn-level tip immediately before theFinalized buildlog whenever any snapshot in a build had Layout review mode enabled (enableLayout, set via global config or per-snapshot).build.layoutUsed) in the queuepushhandler; emission is gated in theendhandler, so it logs at most once per process.endhandler, socli-buildfinalize needs no change.[percy]prefix at normal log level):Changes
packages/core/src/snapshot.js— detection inpushhandler + guardedwarninendhandler.packages/core/test/snapshot.test.js— 4 new specs.Testing
snapshot.test.js, all passing:enableLayoutis set globally in configeslintfrom repo root).install.test.js(global.__MOCK_IMPORTS__undefined; ESM loader hook) and oneapi.test.jsserver-disabled spec (AggregateErrorvsECONNREFUSED, a Node networking quirk). No snapshot/finalize/layout specs fail.Post-Deploy Monitoring & Validation
Tip: VRA is Percy's recommended visual review mode.npx percy snapshotwithenableLayout: true(global or per-snapshot) → tip appears once just beforeFinalized build.Finalized buildordering → revert this commit (log-only change, safe to revert).Update: instrumentation of the recommendation
The VRA tip is now also instrumented via a build event so we can measure how often the recommendation is shown:
PercyClient#sendBuildEventsto optionally accept the newer top-level paramsevent_nameandcategory(backward compatible — existing callers unchanged; when omitted the API applies its defaults).event_name:percy_cli_vra_recommendation_emittedcategory:percy:clidata:{ message: "VRA recommendation shown for a build using Layout review mode" }Note:
categorywas set topercy:cli(the CLI-side sibling of thepercy:appexample) since it wasn't specified — easy to change if a different taxonomy is preferred.Added tests: client
sendBuildEventswithevent_name/category, and core specs asserting the event is sent (filtered byevent_name) only when Layout is used.